<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>新增学生信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel=stylesheet href="css/demo.css" type="text/css">
	
    <script type="text/javascript">
       var xmlhttp;
function createXMLRequset(){
    	if (window.XMLHttpRequest) {
    		// code for IE7+, Firefox, Chrome, Opera, Safari
    	  		xmlhttp=new XMLHttpRequest();
    	  }else {// code for IE6, IE5
    	 		 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
    }
function change(){
    	if(xmlhttp.readyState==4&&xmlhttp.status==200){
    		document.getElementById("umsg").innerHTML=xmlhttp.responseText;
    	}
    }

function getname(){
     var name=document.getElementById("stuName").value;
          if(name==""){
              alert("用户名不能为空");
              document.getElementById("stuName").focus();  
          }
          if(name.length<6){
      	    alert("您的用户名不足6位，请重新输入！");
      	    document.getElementById("stuName").focus();
          }
    }    
function getnumber(){
       var stunumber=document.getElementById("stuNumber").value
	    if(stunumber==""){
          alert("学号不能为空 ");
          document.getElementById("stuNumber").focus();
          } 
        if(isNaN(stunumber)){
         alert("学号必须填写数字！");
         document.getElementById("stuNumber").focus();
          }
      createXMLRequset();
	  xmlhttp.onreadystatechange=change;
	  xmlhttp.open("GET","AddStudent?a="+stunumber , true);
	  xmlhttp.send();
       
	  }

function getpassword(){
      var password=document.getElementById("password").value;
         if(password==""){
             alert("口令不能为空");
             document.getElementById("password").focus();  
         }else if(password.length<6){
     	    alert("口令不足6位，请重新输入！");
     	    document.getElementById("password").focus();
         }
        }
function back(){
	      alert("返回");
		window.history.back(-1);
	  }
function $(id){
	return document.getElementById(id);
	}
function checkForm(){
	if($('stuName').value==""){
		$('stuName').focus();
		return false;
		
	}
	else if($('stuNumber').value==""){
		$('stuNumber').focus();
		return false;
		
	}
	else if($('password').value==""){
		$('password').focus();
		return false;
		
	}
	else if($('stuBirthday').value==""){
		$('stuBirthday').focus();
		return false;
		
		}
	else return true;   
}



</script>
 </head>
	<body  topmargin="10" leftmargin="10"  >

	<form name="frmAction"  method="post" action="Student_add.action" onsubmit="return checkForm()">
          <input type="hidden" name="action" value="add">
	<table width="95%" border="0" cellpadding="3" cellspacing="1" class="toolBar" align="center">

      		<tr align=left class="colom">

			<td colspan="2">新增学生信息</td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>姓名&nbsp;</td>

			<td bgcolor='#ffffff'><input type="text" id="stuName" name="student.stuname" onblur="getname()"/><font color=#ff0000>*</font></td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>学号&nbsp;</td>

			<td bgcolor='#ffffff'><input type="text" id="stuNumber" name="student.stunumber" onblur="getnumber()"/><span id="umsg" width="20"></span></td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>口令&nbsp;</td>

			<td bgcolor='#ffffff'><input type="password" id="password" name="student.password" onblur="getpassword()"/><font color=#ff0000>*</font></td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>生日&nbsp;</td>

			<td bgcolor='#ffffff'>

				<input type="text" id="stuBirthday"  name="student.birthday"  value="2000-01-01" >

				 </td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>性别&nbsp;</td>

			<td bgcolor='#ffffff'><input type="radio" checked value="1" name="student.sex" >男

								  <input type="radio" value="2" name="stuSex" >女

			</td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>政法面貌&nbsp;</td>

			<td bgcolor='#ffffff'>

				<select  name="student.stuPolity" >

					<option value="1">党员</option>

					<option value="2">团员</option>

					<option value="3">无党派</option>

					<option value="4">其它</option>

				</select>

			</td>

		</tr>

		<tr class=even>

			<td width='100' align='right' nowrap>简介&nbsp;</td>

			<td bgcolor='#ffffff'><textarea cols=30 rows=5 name="student.stuBrief" ></textarea>

			字符个数不多于250个

			</td>

		</tr>



		<tr class=even>

		   	<td  height=35 colspan="2" >

	   			<input class="input" type="submit" value="确定" />

				<input class="input" type="button" value="返回" onclick="back()"/>

		   </td>

		</tr>        

	</table>
        <input type="hidden" name="student.type" value="3">
        <input type="hidden" name="student.state" value="1">
	</form>

	<iframe name='hideFrame' style="display:none"></iframe>

</body>
	


  </head>
  
  <body>

  </body>
</html>
